import { PayloadMcuid } from '@libs/common/decorator';
import { IndexInterceptor } from '@libs/common/interceptors';
import { Body, Controller, Get, Post, UseInterceptors } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';

import { DeviceRoadService } from './device-road.service';
import { IndexDeviceRoadDto, ShowDeviceRoadDto } from './dto/device-road.dto';

@ApiTags('ATM货道配置')
@Controller('/atm/device-road')
export class DeviceRoadController {
  constructor(private readonly deviceRoadService: DeviceRoadService) {}

  @Post('index')
  @UseInterceptors(new IndexInterceptor())
  index(@Body() dto: IndexDeviceRoadDto, @PayloadMcuid() mcuid: string) {
    return this.deviceRoadService.index(dto, mcuid);
  }

  @Post('show')
  show(@Body() dto: ShowDeviceRoadDto, @PayloadMcuid() mcuid: string) {
    return this.deviceRoadService.show(dto, mcuid);
  }

  @Get('init')
  initializeData(@PayloadMcuid() mcuid: string) {
    return this.deviceRoadService.initializeData(mcuid);
  }
}
